package org.elasticsearch.plugin.helloworld;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.common.component.Lifecycle.State;
import org.elasticsearch.common.component.LifecycleComponent;
import org.elasticsearch.common.component.LifecycleListener;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;

public class HelloService implements LifecycleComponent<Object> {
	final ESLogger logger = Loggers.getLogger(getClass());
	
	@Inject
	public HelloService(InjectableService injectableService) {
		injectableService.inject();
	}
	
	public String sayHello(String name) {
		return "hello " + name + ", how are you.";
	}

	@Override
	public void close() throws ElasticsearchException {
		// TODO Auto-generated method stub
	}

	@Override
	public State lifecycleState() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void addLifecycleListener(LifecycleListener listener) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void removeLifecycleListener(LifecycleListener listener) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Object start() throws ElasticsearchException {
		logger.info("start method invoked");
		return null;
	}

	@Override
	public Object stop() throws ElasticsearchException {
		// TODO Auto-generated method stub
		return null;
	}
}
